home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PCMania 73
/
PCMania CD73_1.iso
/
pcmania
/
demosc73
/
CFADE2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-09-30
|
3KB
|
100 lines
{ HEY! PcManíacos: }
{ Si queréis contactar con el autor de esta sección, }
{ ahora podéis hacerlo a través de su e-mail privado: }
{ Miquel Barceló: (Demoscene) }
{ e-mail: MBarceloJ@nexo.es }
{ -------------------------------------------------------------- }
{$N+,E+}
uses dos,crt,graf;
var
mixpant : pointer;
pant1 : pointer;
pant2 : pointer;
pal1 : paleta;
pal2 : paleta;
palcf1 : paleta;
palcf2 : paleta;
conta : word;
procedure calc_mix_pant(var p1,p2; pal1,pal2:paleta);
var
cont : word;
mixcol : byte;
begin
for cont:=0 to 63999 do
begin
mixcol:=((MEM[seg(p1):ofs(p1)+cont] and 15)shl 4)+
(MEM[seg(p2):ofs(p2)+cont] and 15);
MEM[seg(mixpant^):ofs(mixpant^)+cont]:=mixcol;
end;
for cont:=0 to 255 do
begin
palcf1[cont]:=pal1[(cont shr 4) and 15];
palcf2[cont]:=pal2[cont and 15];
end;
end;
procedure set_crossfade(pal1,pal2 : paleta; percent : word);
VAR
cont : word;
palm : paleta;
begin
for cont:=0 to 255 do
begin
palm[cont].r:=(percent*pal1[cont].r+(256-percent)*pal2[cont].r)shr 8;
palm[cont].g:=(percent*pal1[cont].g+(256-percent)*pal2[cont].g)shr 8;
palm[cont].b:=(percent*pal1[cont].b+(256-percent)*pal2[cont].b)shr 8;
end;
esperavga;
putpaleta(palm);
end;
begin
getmem (pant1,64000);
getmem (pant2,64000);
getmem (mixpant,64000);
set_vga;
load_PCX('birdy.pcx',pant1^);
getpaleta(pal1);
load_PCX('pcmania2.pcx',pant2^);
getpaleta(pal2);
calc_mix_pant(pant1^,pant2^,pal1,pal2);
flip (mixpant^,vga^);
for conta:=0 to 255 do putrgb(conta,(conta and 15) shl 2,0,((conta shr 4)and 15)shl 2);
readkey;
repeat
conta:=0;
repeat
inc (conta);
set_crossfade(palcf1,palcf2,256*conta div 100);
until (keypressed) or (conta=100);
conta:=0;
repeat
inc (conta);
set_crossfade(palcf2,palcf1,256*conta div 100);
until (keypressed) or (conta=100);
until keypressed;
set_text;
freemem (pant1,64000);
freemem (pant2,64000);
freemem (mixpant,64000);
end.